home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / SNNSV32.ZIP / SNNSv3.2 / kernel / sources / kr_art2.ph < prev    next >
Encoding:
Text File  |  1994-04-25  |  12.8 KB  |  519 lines

  1. /*****************************************************************************
  2.   FILE           : kr_art2.ph
  3.   SHORTNAME      : kr_art2 
  4.   SNNS VERSION   : 3.2
  5.  
  6.   PURPOSE        : SNNS Kernel Function Prototypes for ART2-Networks
  7.   NOTES          :
  8.  
  9.   AUTHOR         : Kai-Uwe Herrmann
  10.   DATE           : 17.05.92
  11.  
  12.   CHANGED BY     : Sven Doering
  13.   IDENTIFICATION : @(#)kr_art2.ph    1.6 3/15/94
  14.   SCCS VERSION   : 1.6
  15.   LAST CHANGE    : 3/15/94
  16.  
  17.              Copyright (c) 1990-1994  SNNS Group, IPVR, Univ. Stuttgart, FRG
  18.  
  19. ******************************************************************************/
  20. #ifndef _KR_ART2_DEFINED_
  21. #define  _KR_ART2_DEFINED_
  22.  
  23. /* begin global definition section */
  24.  
  25. /************* Global variables
  26. *************/
  27.  int              Art2_NoOfRecUnits;
  28.  struct Unit     *Art2_cl_unit;
  29.  struct Unit     *Art2_nc_unit;
  30.  
  31. /**************** Function Prototypes
  32. ****************/
  33.  
  34. /***************************************************************************/
  35. /* kra2_init_propagate ()
  36.  
  37.    initializes net for propagation.
  38. */
  39.  krui_err  kra2_init_propagate (
  40.                                       void
  41.                                      );
  42.  
  43.  
  44. /***************************************************************************/
  45. /* kra2_sort ()
  46.  
  47.    Set logical layer numbers and logical unit numbers in an ART2 network.
  48.    Also this function checks, whether the network is an ART2 network or not.
  49.    Returns an error code, when actual network is no ART2 architecture.
  50. */
  51.  krui_err  kra2_sort (
  52.                             void
  53.                            );
  54.  
  55.  
  56.  
  57. /***************************************************************************/
  58. /* kra2_set_params ()
  59.  
  60.    Sets the value of Parameters rho, a, b, c, d, theta, which are stored locally
  61.    in this Module.
  62. */
  63.  krui_err kra2_set_params (
  64.                                 FlintType rho,
  65.                                 FlintType param_a,
  66.                                 FlintType param_b,
  67.                                 FlintType param_c,
  68.                                 FlintType param_d,
  69.                                 FlintType theta
  70.                                );
  71.  
  72.  
  73. /***************************************************************************/
  74. /* kra2_get_rho ()
  75.  
  76.    returns the actual value of Parameter rho.
  77. */
  78.  FlintType kra2_get_rho (
  79.                                void
  80.                               );
  81.  
  82. /***************************************************************************/
  83. /* kra2_get_a ()
  84.  
  85.    returns the actual value of Parameter a.
  86. */
  87.  FlintType kra2_get_a (
  88.                              void
  89.                             );
  90.  
  91. /***************************************************************************/
  92. /* kra2_get_b ()
  93.  
  94.    returns the actual value of Parameter b.
  95. */
  96.  FlintType kra2_get_b (
  97.                              void
  98.                             );
  99.  
  100. /***************************************************************************/
  101. /* kra2_get_c ()
  102.  
  103.    returns the actual value of Parameter c.
  104. */
  105.  FlintType kra2_get_c (
  106.                              void
  107.                             );
  108.  
  109.  
  110. /***************************************************************************/
  111. /* kra2_get_d ()
  112.  
  113.    returns the actual value of Parameter d.
  114. */
  115.  FlintType kra2_get_d (
  116.                              void
  117.                             );
  118.  
  119.  
  120. /***************************************************************************/
  121. /* kra2_get_theta ()
  122.  
  123.    returns the actual value of Parameter theta.
  124. */
  125.  FlintType kra2_get_theta (
  126.                                  void
  127.                                 );
  128.  
  129.  
  130. /***************************************************************************/
  131. /* kra2_checkReset ()
  132.  
  133.    checks if global reset has to be sent into network
  134. */
  135.  void kra2_checkReset (
  136.                              void
  137.                             );
  138.  
  139.  
  140.  
  141.  
  142. /***************************************************************************/
  143. /* kra2_Reset ()
  144.  
  145.    returns TRUE if global reset is actually active, else FALSE
  146. */
  147.  bool kra2_Reset (
  148.                         void
  149.                        );
  150.  
  151.  
  152.  
  153.  
  154. /***************************************************************************/
  155. /* kra2_init_pattern ()
  156.  
  157.    sets current phase to bottom up
  158. */
  159.  void kra2_init_pattern (
  160.                                void
  161.                               );
  162.  
  163.  
  164.  
  165. /***************************************************************************/
  166. /* kra2_top_dn_phase ()
  167.  
  168.    sets current phase to bottom up
  169. */
  170.  bool kra2_topdn_phase (
  171.                              void
  172.                             );
  173.  
  174.  
  175.  
  176. /***************************************************************************/
  177. /* kra2_compute_norms ()
  178.  
  179.    computes the L2 vector norms of inp, w, u, v, p, r
  180. */
  181.  
  182.  void kra2_compute_norms (
  183.                                 void
  184.                                );
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191. /***************************************************************************/
  192. /* kra2_L2_Norm ()
  193.  
  194.    returns the L2-Norm of a vector which is determined by the number
  195.    of the Layer in the topo_ptr_array.
  196. */
  197.  
  198.  FlintType kra2_L2_Norm (
  199.                                int VectorNr
  200.                               );
  201.  
  202.  
  203.  
  204. /***************************************************************************/
  205. /* kra2_classified ()
  206.  
  207.    returns TRUE if net has classified input pattern
  208. */
  209.  bool kra2_classified (
  210.                              void
  211.                             );
  212.  
  213.  
  214.  
  215. /***************************************************************************/
  216. /* kra2_not_classifiable ()
  217.  
  218.    returns TRUE if net is not able to classify input pattern
  219. */
  220.  bool kra2_not_classifiable (
  221.                                    void
  222.                                   );
  223.  
  224.  
  225.  
  226. /***************************************************************************/
  227. /* kra2_save_for_stability_check ()
  228.  
  229.    saves informaion of relevant unit in F1-Layer for stability check
  230. */
  231.  void kra2_save_for_stability_check (
  232.                                            void
  233.                                           );
  234.  
  235.  
  236.  
  237. /***************************************************************************/
  238. /* kra2_check_f1_stability ()
  239.  
  240.    checks, if F1-Layer is stable.
  241. */
  242.  void kra2_check_f1_stability (
  243.                                      void
  244.                                     );
  245.  
  246.  
  247.  
  248.  
  249.  
  250. /***************************************************************************/
  251. /* kra2_f1_stable ()
  252.  
  253.    returns TRUE if F1-Layer is stable
  254. */
  255.  bool kra2_f1_stable (
  256.                             void
  257.                            );
  258.  
  259.  
  260.  
  261.  
  262. /***************************************************************************/
  263. /* kra2_getClassNo ()
  264.  
  265.    Returns the number of the actually activated class J, 1 <= J <= M
  266. */
  267.  int  kra2_getClassNo (void
  268.                             );
  269.  
  270.  
  271. /* end global definition section */
  272.  
  273. /* begin private definition section */
  274.  
  275.  
  276. /*#################################################
  277.  
  278. GROUP: local defines
  279.  
  280. #################################################*/
  281.  
  282.  
  283.  
  284. #define MIN_NO_OF_DELAY_STEPS   5                /* when checking if pattern has been
  285.                                                     classified F1 layer has to be stable
  286.                                                     over MIN_NO_OF_DELAY_STEPS cycles
  287.                                                  */
  288.  
  289. #define F1_STABILITY_PARAM      0.0001           /* if difference of activation in all
  290.                                                     u units between two prop cycles are
  291.                                                     less or equal to F1_STABILITY_PARAM
  292.                                                     then F1 is stable
  293.                                                  */
  294.  
  295.  
  296. /*#################################################
  297.  
  298. GROUP: global variables, local to this module
  299.  
  300. #################################################*/
  301.  
  302. /* Global variable for parameter values */
  303.  
  304. static FlintType      Param_rho   = 0.8;
  305. static FlintType      Param_a     = 0.0;
  306. static FlintType      Param_b     = 0.0;
  307. static FlintType      Param_c     = 0.0;
  308. static FlintType      Param_d     = 0.0;
  309. static FlintType      Param_theta = 0.5;
  310.  
  311. /* Global variables for vector norms */
  312.  
  313. static FlintType      NormInp     = 0.0;
  314. static FlintType      NormW       = 0.0;
  315. static FlintType      NormU       = 0.0;
  316. static FlintType      NormV       = 0.0;
  317. static FlintType      NormP       = 0.0;
  318. static FlintType      NormR       = 0.0;
  319.  
  320.  
  321. static TopoPtrArray   topo_layer[10];      /* contains pointers to first pointer
  322.                                               to inp unit, first pointer
  323.                                               to w unit, x unit ... in the topo
  324.                                               pointer array
  325.                                            */
  326.  
  327. static int            NoOfDelaySteps = 0;
  328.  
  329. static bool           GlobalReset     = FALSE;
  330. static bool           TopDownPhase;
  331. static bool           f1_stable = FALSE;   /* becomes TRUE if F1-Layer is stable
  332.                                               (see kra2_check_f1_stability)
  333.                                            */
  334.  
  335. /* functions that are local to this module
  336. */
  337.  
  338. static void   kra2_set_fix_weight (
  339.  
  340.                                    struct Unit   *src_unit,
  341.                                    struct Unit   *trgt_unit,
  342.                                    FlintType     *weight
  343.  
  344.                                   );
  345.  
  346.  
  347. static FlintType  kra2_compute_l2_norm (
  348.  
  349.                                         int Layer
  350.  
  351.                                        );
  352.  
  353. static int  kra2_get_NoOfRecUnits (
  354.  
  355.                                    void
  356.  
  357.                                   );
  358.  
  359.  
  360. static krui_err  kra2_get_InpUnits (
  361.  
  362.                                     TopoPtrArray  *topo_ptr
  363.  
  364.                                    );
  365.  
  366.  
  367. static krui_err  kra2_get_WUnits (
  368.  
  369.                                   TopoPtrArray *topo_ptr,
  370.                                   int          *no_of_w_units
  371.  
  372.                                  );
  373.  
  374.  
  375. static krui_err  kra2_get_XUnits (
  376.  
  377.                                   TopoPtrArray *topo_ptr,
  378.                                   int          *no_of_x_units
  379.  
  380.                                  );
  381.  
  382.  
  383. static krui_err  kra2_get_UUnits (
  384.  
  385.                                   TopoPtrArray *topo_ptr,
  386.                                   int          *no_of_u_units
  387.  
  388.                                  );
  389.  
  390.  
  391. static krui_err  kra2_get_VUnits (
  392.  
  393.                                   TopoPtrArray *topo_ptr,
  394.                                   int          *no_of_v_units
  395.  
  396.                                  );
  397.  
  398.  
  399. static krui_err  kra2_get_PUnits (
  400.  
  401.                                   TopoPtrArray *topo_ptr,
  402.                                   int          *no_of_p_units
  403.  
  404.                                  );
  405.  
  406.  
  407. static krui_err  kra2_get_QUnits (
  408.  
  409.                                   TopoPtrArray *topo_ptr,
  410.                                   int          *no_of_q_units
  411.  
  412.                                  );
  413.  
  414.  
  415. static krui_err  kra2_get_RUnits (
  416.  
  417.                                   TopoPtrArray *topo_ptr,
  418.                                   int          *no_of_r_units
  419.  
  420.                                  );
  421.  
  422.  
  423. static krui_err  kra2_get_RecUnits (
  424.  
  425.                                     TopoPtrArray  *topo_ptr
  426.  
  427.                                    );
  428.  
  429.  
  430. static krui_err  kra2_get_RstUnits (
  431.  
  432.                                     TopoPtrArray  *topo_ptr,
  433.                                     int          *no_of_rst_units
  434.  
  435.                                    );
  436.  
  437.  
  438. static krui_err  kra2_TopoPtrArray (
  439.  
  440.                                     void
  441.  
  442.                                    );
  443.  
  444.  
  445. static krui_err  kra2_LinksToInpUnits (
  446.  
  447.                                        TopoPtrArray *topo_ptr
  448.  
  449.                                       );
  450.  
  451.  
  452. static krui_err  kra2_LinksToWUnits (
  453.  
  454.                                      TopoPtrArray *topo_ptr
  455.  
  456.                                     );
  457.  
  458.  
  459. static krui_err  kra2_LinksToXUnits (
  460.  
  461.                                      TopoPtrArray *topo_ptr
  462.  
  463.                                     );
  464.  
  465.  
  466. static krui_err  kra2_LinksToUUnits (
  467.  
  468.                                      TopoPtrArray *topo_ptr
  469.  
  470.                                     );
  471.  
  472.  
  473. static krui_err  kra2_LinksToVUnits (
  474.  
  475.                                      TopoPtrArray *topo_ptr
  476.  
  477.                                     );
  478.  
  479.  
  480. static krui_err  kra2_LinksToPUnits (
  481.  
  482.                                      TopoPtrArray *topo_ptr
  483.  
  484.                                     );
  485.  
  486.  
  487. static krui_err  kra2_LinksToQUnits (
  488.  
  489.                                      TopoPtrArray *topo_ptr
  490.  
  491.                                     );
  492.  
  493.  
  494. static krui_err  kra2_LinksToRUnits (
  495.  
  496.                                      TopoPtrArray *topo_ptr
  497.  
  498.                                     );
  499.  
  500.  
  501. static krui_err  kra2_LinksToRecUnits (
  502.  
  503.                                        TopoPtrArray *topo_ptr
  504.  
  505.                                       );
  506.  
  507.  
  508. static krui_err  kra2_LinksToRstUnits (
  509.                                        TopoPtrArray *topo_ptr
  510.                                       );
  511.  
  512. static krui_err kra2_init_i_act (void);
  513. static krui_err kra2_init_fix_weights (void);
  514.  
  515. /* end private definition section */
  516.  
  517. #endif 
  518.  
  519.